<extend name="Layout/ins_page" />
<block name="content">
    <link href="/sap/demo.css" rel="stylesheet" type="text/css" />
    <script src="/sap/scripts/boot.js" type="text/javascript"></script>
    <style>
		table img{width: 40px}
 .myrow
    {
        background:#fceee2;
    }
    
.mini-grid-newRow {
    background: white;
}
	</style>
<body style="">

项目类型: <input  id='cgtype'   name="" showNullItem="true" class="mini-combobox" data="[{'id':1,'text':'内部'},{'id':2,'text':'外部'}]" value="<?php echo $info['type']?>" valueField="id" textField="text"  onValuechanged='cgfschange' />
项目负责人: <input  id='cplist'  name="" showNullItem="true" class="mini-combobox" url="/stocking/getBuyer?type=1" valueField="id" textField="text"/> <br/> <br/>

  <div id='editForm1'>
      <form id="beizhuForm">
   <br/> <br/>
     项目描述: <input required="true" id="remarkes" class="mini-textarea" style="width:400px;height: 400px" minWidth="400" minHeight="400" value="<?php echo $info['remarkes']?>" />
    <br/> <br/>
    <a class="mini-button" onclick="save()" enabled="" id='query-bt' >&nbsp;&nbsp;保存&nbsp;&nbsp;</a>
      </form>
  </div>

</body>
<script type="text/javascript">

        function save() {
            //提交表单数据
            var form = new mini.Form("#beizhuForm");
            form.validate();
            if (form.isValid() == false) {
                mini.unmask(document.body);
                mini.alert('请完成必填项!');
                return;
            }

        	var type = mini.get("cgtype").getValue();
        	var cp = mini.get("cplist").getValue();

        	if(type==null||type==''){
        		mini.alert("请选择项目类型");
        		return ;
        	}

        	if(cp==null||cp==''){
        		mini.alert('必须选择项目负责人');
        		return ;
        	}

        	var remarkes =  mini.get('remarkes').getValue();

             mini.mask({
                el: document.body,
                cls: 'mini-mask-loading',
                html: '保存中...'
            }); 
 
            $.ajax({
                url: "/Project/save",
                data: { type:type,cp:cp,remarkes:remarkes},
                type: "post",
                dataType:'json',
                success: function (data) {
                   if(data.code==0){
                	    mini.unmask(document.body);
						mini.alert('保存成功!');
						search();
						return ;
                   }else{
                	   mini.unmask(document.body);
                	   mini.alert(data.msg);
                       }
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(jqXHR.responseText);
                }
            });
        }

    </script>
  
</body>

</block>

<block name="js">
</block>